<template>
    <el-aside width="200px">
        <el-menu
            default-active="2"
            class="el-menu-vertical-demo"
            :unique-opened="isUnique"
            @open="handleOpen"
            @close="handleClose"
            background-color="#545c64"
            text-color="#fff"
            active-text-color="#ffd04b"
        >
            <el-submenu index="1">
                <template slot="title">
                    <i class="el-icon-user-solid"></i>
                    <span>用户管理</span>
                </template>
                <el-menu-item-group>
                    <el-menu-item index="1-1" @click="navUser()">用户管理</el-menu-item>
                    <el-menu-item index="1-2" @click="navPwd()">密码设置</el-menu-item>
                </el-menu-item-group>
            </el-submenu>

            <el-submenu index="2">
                <template slot="title">
                    <i class="el-icon-s-shop"></i>
                    <span>商品管理</span>
                </template>
                <el-menu-item-group>
                    <el-menu-item index="2-1" @click="navCategory">商品分类</el-menu-item>
                    <el-menu-item index="2-2" @click="navGoods()">商品管理</el-menu-item>
                </el-menu-item-group>
            </el-submenu>

            <el-submenu index="3">
                <template slot="title">
                    <i class="el-icon-s-order"></i>
                    <span>订单管理</span>
                </template>
                <el-menu-item-group>
                    <el-menu-item index="3-1" @click="navOrder">订单管理</el-menu-item>
                    <el-menu-item index="3-2">选项2</el-menu-item>
                </el-menu-item-group>
            </el-submenu>

            <el-submenu index="4">
                <template slot="title">
                    <i class="el-icon-s-custom"></i>
                    <span>会员管理</span>
                </template>
                <el-menu-item-group>
                    <el-menu-item index="4-1">选项1</el-menu-item>
                    <el-menu-item index="4-2">选项2</el-menu-item>
                </el-menu-item-group>
            </el-submenu>
        </el-menu>
    </el-aside>
</template>
<script>
export default {
    data() {
        return {
            isUnique: true
        };
    },
    methods: {
        handleOpen(key, keyPath) {
            console.log(key, keyPath);
        },
        handleClose() {},
        navUser() {
            if(this.$route.path != '/admin/admin'){
                this.$router.push("/admin/admin");

            }
        },
        navPwd() {
            if(this.$route.path != '/admin/pwdReset'){
                this.$router.push("/admin/pwdReset");

            }
        },
        navGoods() {
            if(this.$route.path != '/admin/goods'){
                this.$router.push("/admin/goods");
            }
        },
        navOrder() {
            if(this.$route.path != '/admin/order'){
                this.$router.push("/admin/order");
            }
        },
        navCategory(){
            if(this.$route.path != '/admin/category'){
                this.$router.push("/admin/category");
            }
        }
    }
};
</script>
<style scoped>
.el-aside {
    background-color: rgb(84, 92, 100);
    color: #333;
    text-align: center;
    line-height: 200px;
}
</style>
